package exchain

import (
	"github.com/lzzyuhyy/framework/mysql"
	"gorm.io/gorm"
)

type ExChain struct {
	gorm.Model
	Title  string `gorm:"type:varchar(255);comment:标题"`
	Src    string `gorm:"type:varchar(255);comment:链接地址"`
	Cover  string `gorm:"type:varchar(255);comment:封面"`
	Sort   int    `gorm:"type:int(11);default:0;comment:排序值"`
	Status int8   `gorm:"type:tinyint(1);default:1;comment:状态"`
}

func GetExChainList() (list []ExChain, err error) {
	err = mysql.CreateMySQLClient(func(db *gorm.DB) error {
		return db.Order("sort DESC").Limit(5).Find(&list).Error
	})
	return
}
